
package com.epam.android.training.day3;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

/**
 * @author pavel_busko
 * 
 * Sample activity to test resources.
 */
public class TestActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i("TestActivity", "onCreate");
        setContentView(R.layout.main);
        Boolean isReconfigured = (Boolean) getLastNonConfigurationInstance();
        TextView textView = (TextView) findViewById(R.id.textView);
        if (isReconfigured != null) {
            textView.setText(getResources().getString(R.string.configuration_changed));
        } else {
            textView.setText(getResources().getString(R.string.first_start));
        }

    }

    @Override
    protected void onDestroy() {
        Log.i("TestActivity", "onDestroy");
        super.onDestroy();
    }

    @Override
    protected void onPause() {
        Log.i("TestActivity", "onPause");
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i("TestActivity", "onResume");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i("TestActivity", "onStart");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i("TestActivity", "onRestart");
    }

    @Override
    protected void onStop() {
        Log.i("TestActivity", "onStop");
        super.onStop();
    }

    @Override
    public Object onRetainNonConfigurationInstance() {
        return Boolean.TRUE;
    }

}
